/**
 * Code Assistant Skill
 * 
 * A skill for code-related tasks including reading, writing, and executing code
 */

import type { Skill } from '../skill-manager';
import {
  readFileTool,
  writeFileTool,
  listDirectoryTool,
  searchFilesTool,
} from '@/tools/builtin/file-tools';
import {
  executeJavaScriptTool,
  executePythonTool,
  executeShellTool,
  evaluateExpressionTool,
} from '@/tools/builtin/code-execution';

export const codeAssistantSkill: Skill = {
  id: 'code-assistant',
  name: 'Code Assistant',
  description: 'Help with coding tasks including reading, writing, and executing code',
  category: 'code_generation',
  version: '1.0.0',
  author: 'CAgent Team',
  
  tools: [
    readFileTool,
    writeFileTool,
    listDirectoryTool,
    searchFilesTool,
    executeJavaScriptTool,
    executePythonTool,
    executeShellTool,
    evaluateExpressionTool,
  ],
  
  systemPrompt: `You are a code assistant with access to file operations and code execution tools.

Your capabilities include:
- Reading and writing code files
- Executing JavaScript, TypeScript, and Python code
- Running shell commands
- Searching for files and code patterns
- Evaluating expressions

When helping with code:
1. Read existing code to understand the context
2. Write clean, well-documented code
3. Test code by executing it when appropriate
4. Provide explanations for your code changes
5. Follow best practices and coding standards

Always prioritize code quality, security, and maintainability.`,

  examples: [
    {
      title: 'Create a utility function',
      description: 'Write a utility function to a file',
      input: 'Create a function to calculate factorial in utils/math.ts',
      expectedOutput: 'I\'ll write a well-documented factorial function with proper TypeScript types.',
    },
    {
      title: 'Debug code',
      description: 'Read and debug existing code',
      input: 'Find and fix the bug in src/calculator.ts',
      expectedOutput: 'I\'ll read the file, identify the issue, and provide a fix with explanation.',
    },
    {
      title: 'Run tests',
      description: 'Execute test files',
      input: 'Run the tests in tests/unit/',
      expectedOutput: 'I\'ll execute the test files and report the results.',
    },
  ],
  
  metadata: {
    tags: ['code', 'programming', 'development', 'testing'],
    difficulty: 'intermediate',
    estimatedSetupTime: '1 minute',
  },
};

